﻿package base
{
    import com.dusk.game.Logger;
    import com.dusk.util.ArrayUtil;
    import com.dusk.util.McUtil;
    import com.dusk.util.ResUtil;
    import com.game.data.constant.AddEffectType;
    import com.game.data.constant.FrameRate;
    import com.game.data.constant.HitType;
    import com.game.data.vo.HitResultVO;
    import com.game.data.vo.PlayerDataVO;
    import com.game.data.vo.AddEffectVO;
    import com.game.manager.AnimationManager;
    import com.game.manager.SettingManager;
    import com.game.view.display.AnimationClip;
    import com.greensock.TweenMax;
    
    import config.Config;
    
    import export.bullet.FollowTargetBullet;
    import export.hero.Role1;
    import export.hero.Role2;
    import export.hero.Role3;
    import export.hero.Role4;
    import export.monster.VoodooDoll;
    
    import flash.display.DisplayObject;
    import flash.display.MovieClip;
    import flash.filters.BitmapFilterQuality;
    import flash.filters.GlowFilter;
    import flash.geom.Point;
    import flash.utils.getTimer;
    
    public class BaseAddEffect
    {
        //noinspection SpellCheckingInspection
        /*----------------------------------公共属性--------------------------------------*/
        public static const FIRE:String = "fire";
        
        public static const ICE:String = "ice";
        
        public static const STUN:String = "stun";
        
        public static const SHIELD:String = "shield";
        
        public static const REFLECT_SHIELD:String = "rejectShield";
        
        public static const SLEEP:String = "sleep";
        
        public static const POISON:String = "poison";
        
        public static const POISON_TIMES:String = "poisonTimer";
        
        public static const SPEED_UP:String = "speedUp";
        
        public static const SPEED_DOWN:String = "speedDown";
        
        public static const CONSTANT_ADD_HP:String = "constantAddHp";
        
        public static const CONSTANT_ADD_MP:String = "constantAddMp";
        
        public static const CONSTANT_LOSE_HP:String = "constantLoseHp";
        
        public static const CONSTANT_LOSE_MP:String = "constantLoseMp";
        
        public static const REFLECT_HURT_AS_HP:String = "reflectHurtAsHp";
        
        public static const REFLECT_HURT_AS_MP:String = "reflectHurtAsMp";
        
        public static const STEEL_BODY:String = "steel_body";
        
        public static const EYE_FIX:String = "eyeFix";
        
        public static const BLEED:String = "bleed";
        
        public static const FORBID_ADD_HP:String = "forbidAddHp";
        /*----------------------------------公共属性--------------------------------------*/
        
        
        /*----------------------------------法宝属性--------------------------------------*/
        public static const MAGIC_LEAF_CURE:String = "magicLeafEffect";
        
        public static const MAGIC_FLAG_DEBUFF:String = "MagicFlagDebuff";
        
        public static const MAGIC_FLOWER_ADDBUFF:String = "MagicFlowerAddbuff";
        
        public static const MAGIC_FLOWER_DEBUFF:String = "MagicFlowerDebuff";
        
        public static const LXFB_BUFF:String = "xlfb_buff";
        
        public static const SXFB_BUFF:String = "sxfb_buff";
        
        public static const YXFB_BUFF:String = "yxfb_buff";
        /*----------------------------------法宝属性--------------------------------------*/
        
        
        /*----------------------------------角色专属--------------------------------------*/
        public static const CURE_AFTER_KILL_MONSTER:String = "cureAfterKillMonster";
        
        public static const BAJIE_DUNPAI_BUFF:String = "showBajieDunpaiBuff";
        
        public static const JIUHUANSHENGJING:String = "jiuhuanshengjing";
        /*----------------------------------角色专属--------------------------------------*/
        
        
        /*----------------------------------宠物专属--------------------------------------*/
        public static const PET_SXKB:String = "sxkb";
        
        public static const PET_FSNL:String = "fsnl";
        
        public static const PET_SMJC:String = "smjc";
        
        public static const PET_MFJC:String = "mfjc";
        
        public static const PET_GJJC:String = "gjjc";
        
        public static const PET_FYJC:String = "fyjc";
        
        public static const PET_TIGER_SXHZ:String = "pet_tiger_sxhz";
        
        public static const PET_RABBIT_MISS:String = "petRabbitMissUp";
        
        public static const PET_RABBIT4_BUFF:String = "petRabbit4Buff";
        
        public static const PET_TURTLE_BUFF:String = "petTurtleBuff";
        /*----------------------------------宠物专属--------------------------------------*/
        
        
        /*----------------------------------怪物专属--------------------------------------*/
        public static const MONSTER36Bullet4:String = "monster36bullet4";
        
        public static const Monster37FIX:String = "monster37fix";
        
        public static const MONSTER42_GREEN:String = "monster42_green";
        
        public static const MONSTER42_BLUE:String = "monster42_blue";
        
        public static const MONSTER115REDUCEHP:String = "monster115reducehp";
        
        public static const MONSTER53_TIE:String = "monster53_tie";
        
        public static const MONSTER65_TIED_PET:String = "monster65_tied_pet";
        
        public static const MONSTER65_AOE:String = "monster65_aoe";
        
        public static const MONSTER66HURT:String = "monster66hurt";
        
        public static const MONSTER114FEAR:String = "Monster114Fear";
        
        public static const MONSTER117SLEEP:String = "monster117sleep";
        
        public static const MONSTER120DEBUFF:String = "monster120debuff";
        
        public static const TIANTINGZHANSHEN:String = "tiantingzhansheng";
        
        public static const MONSTER129Buff:String = "monster129buff";
        
        public static const MONSTER131MUSIC1:String = "monster131music1";
        
        public static const MONSTER131MUSIC2:String = "monster131music2";
        
        public static const MONSTER135Buff:String = "monster135buff";
        
        public static const MONSTER137BUFF:String = "monster137buff";
        
        /*----------------------------------怪物专属--------------------------------------*/
        
        public function BaseAddEffect(object:BaseObject)
        {
            super();
            curEffectArray = [];
            sourceRole = object;
        }
        private var sourceRole:BaseObject;
        private var curEffectArray:Array;
        private var glow:GlowFilter;
        private var _framer:int = 0;
        
        private function get gc():Config
        {
            return Config.getIns();
        }
        
        public function step():void
        {
            if (!sourceRole || sourceRole.isDead())
            {
                return;
            }
            for each (var effect:AddEffectVO in curEffectArray)
            {
                //isFirst代码块是对于buff的初始化，包括初始化外观之类的一系列效果
                if (effect.isFirstAdd)
                {
                    effect.isFirstAdd = false;
                    effect.startTime = _framer;
                    switch (effect.type)
                    {
                        case AddEffectType.ROLE1_PASSIVE_FIRE:
                            showRole1PassiveFire();
                            break;
                        case AddEffectType.ROLE1_SKILL_HYJJ:
                            showRole1SkillHyjj();
                            break;
                        case AddEffectType.POISON:
                            showPoison();
                            break;
                        case AddEffectType.STUN:
                            showStun();
                            break;
                    }
                    /*{
                        if (effect.type == POISON)
                        {
                            showPoison();
                        }
                        else if (effect.type == ICE)
                        {
                            showIce();
                        }
                        else if (effect.type == SPEED_UP)
                        {
                            showSpeedUp();
                        }
                        else if (effect.type == EYE_FIX)
                        {
                            showEyeFix();
                        }
                        else if (effect.type == STUN)
                        {
                            showStun();
                            sourceRole.setStatic();
                        }
                        else if (effect.type == BAJIE_DUNPAI_BUFF)
                        {
                            showBajieDunpaiBuff();
                        }
                        else if (effect.type == MAGIC_LEAF_CURE)
                        {
                            show_magic_laf_cure();
                        }
                        else if (effect.type == SHIELD)
                        {
                            show_magic_umb_def();
                        }
                        else if (effect.type == REFLECT_SHIELD)
                        {
                            show_magic_umb_def();
                        }
                        else if (effect.type == FIRE)
                        {
                            showFire();
                        }
                        else if (effect.type == PET_RABBIT4_BUFF)
                        {
                            showPetRabbit4Buff();
                        }
                        else if (effect.type == PET_SXKB)
                        {
                            show_sxkb();
                        }
                        else if (effect.type == PET_FSNL)
                        {
                            show_fsnl();
                        }
                        else if (effect.type == PET_SMJC)
                        {
                            show_smjc();
                        }
                        else if (effect.type == PET_MFJC)
                        {
                            show_mfjc();
                        }
                        else if (effect.type == PET_GJJC)
                        {
                            show_gjjc();
                        }
                        else if (effect.type == PET_FYJC)
                        {
                            show_fyjc();
                        }
                        else if (effect.type == FORBID_ADD_HP)
                        {
                            show_forbidAddHp();
                        }
                        else if (effect.type == MONSTER36Bullet4)
                        {
                            show_monster36bullet4();
                        }
                        else if (effect.type == Monster37FIX)
                        {
                            show_monster37fix();
                        }
                        else if (effect.type == CURE_AFTER_KILL_MONSTER)
                        {
                            show_shenmishangren();
                        }
                        else if (effect.type == PET_TIGER_SXHZ)
                        {
                            show_pet_tiger_sxhz(effect.frame, effect.direct);
                        }
                        else if (effect.type == MONSTER42_GREEN)
                        {
                            show_monster42_green();
                        }
                        else if (effect.type == MONSTER42_BLUE)
                        {
                            show_monster42_blue();
                        }
                        else if (effect.type == MONSTER65_TIED_PET)
                        {
                            showMonster65tied();
                        }
                        else if (effect.type == MONSTER65_AOE)
                        {
                            showMonster65aoe();
                        }
                        else if (effect.type == MONSTER66HURT)
                        {
                            showMonster66hurt();
                        }
                        else if (effect.type == MONSTER114FEAR)
                        {
                            showMonster114Fear();
                        }
                        else if (effect.type == MONSTER115REDUCEHP)
                        {
                            showMonster115Reducehp();
                        }
                        else if (effect.type == MONSTER117SLEEP)
                        {
                            showMonster117sleep();
                        }
                        else if (effect.type == TIANTINGZHANSHEN)
                        {
                            showTiantingZhanshen();
                        }
                        else if (effect.type == MONSTER129Buff)
                        {
                            showMonster129Buff();
                        }
                        else if (effect.type == MONSTER131MUSIC1)
                        {
                            showMonster131Music1();
                        }
                        else if (effect.type == MONSTER131MUSIC2)
                        {
                            showMonster131Music2();
                        }
                        else if (effect.type == MONSTER135Buff)
                        {
                            showMonster135Buff();
                        }
                        else if (effect.type == MONSTER137BUFF)
                        {
                            effect.frames = 1;
                        }
                        else if (effect.type == MAGIC_FLAG_DEBUFF)
                        {
                            showMagicFlagDebuff();
                        }
                        else if (effect.type == MAGIC_FLOWER_ADDBUFF)
                        {
                            showMagicFlowerAddbuff();
                        }
                        else if (effect.type == MAGIC_FLOWER_DEBUFF)
                        {
                            showMagicFlowerDebuff();
                        }
                        else if (effect.type == PET_RABBIT_MISS)
                        {
                            showPetRabbitMissUp();
                        }
                        else if (effect.type == PET_TURTLE_BUFF)
                        {
                            showPetTurttleBuff();
                        }
                        else if (effect.type == JIUHUANSHENGJING)
                        {
                            show_jiuhuanshengjing();
                        }
                        else if (effect.type == LXFB_BUFF)
                        {
                            showXLFB();
                        }
                        else if (effect.type == SXFB_BUFF)
                        {
                            showSXFB();
                        }
                        else if (effect.type == YXFB_BUFF)
                        {
                            showYXFB();
                        }
                    }*/
                }
                //以下是对每秒生效buff的处理
                /*if (_framer % gc.frameClips == 0)
                {
                    switch (effect.type)
                    {
                        case POISON:
                            sourceRole.reduceHp(effect.value);
                            break;
                        case CONSTANT_ADD_HP:
                            sourceRole.cureHp(effect.value);
                            break;
                        case CONSTANT_ADD_MP:
                            //怪物使用此效果不会有作用
                            sourceRole.cureMp(effect.value);
                            break;
                        case CONSTANT_LOSE_HP:
                            switch (effect.type)
                            {
                                case "figure":
                                default:
                                    sourceRole.reduceHp(effect.value);
                                    break;
                                case "byMax":
                                    sourceRole.reduceHp(effect.value * sourceRole.getHpMax());
                                    break;
                                case "byCur":
                                    sourceRole.reduceHp(effect.value * sourceRole.getHp());
                                    break;
                            }
                            break;
                        case CONSTANT_LOSE_MP:
                            if (!sourceRole is BaseHero)
                            {
                                break;
                            }
                            //暂时不支持怪物使用此effect
                            switch (effect.type)
                            {
                                case "figure":
                                default:
                                    (sourceRole as BaseHero).reduceMp(effect.value);
                                    break;
                                case "byMax":
                                    (sourceRole as BaseHero).reduceMp(effect.value * sourceRole.getMpMax());
                                    break;
                                case "byCur":
                                    (sourceRole as BaseHero).reduceMp(effect.value * sourceRole.getMp());
                                    break;
                            }
                            break;
                        case BAJIE_DUNPAI_BUFF:
                            if (sourceRole is BaseHero)
                            {
                                //八戒
                                var lv:int = BaseHero(sourceRole).getPlayer().returnSkillLevelBySkillName("sd");
                                var val:int = (sourceRole as BaseHero).getAttribute().def / 20 * lv;
                                BaseHero(sourceRole).cureHp(val);
                            }
                            else if (sourceRole is BaseMonster)
                            {
                                //邪八戒
                                BaseMonster(sourceRole).cureHp(int(sourceRole.getHpMax() * 0.01));
                            }
                            break;
                        case FIRE:
                            sourceRole.reduceHp(effect.hurt);
                            break;
                        case Monster37FIX://牛妖抓取
                            sourceRole.reduceHp(2000);
                            break;
                        case BLEED:
                            var pPoint:Point = effect.point;
                            effect.point = new Point(sourceRole.x, sourceRole.y);
                            var hurt:int = Math.abs(int(pPoint.x) - int(effect.point.x)) * 10;
                            sourceRole.reduceHp(hurt);
                            break;
                        case PET_RABBIT4_BUFF:
                            sourceRole.cureHp(sourceRole.getMpMax() * 0.1);
                            break;
                        case MAGIC_FLAG_DEBUFF:
                            sourceRole.reduceHp(sourceRole.getHpMax() * 0.02);
                            break;
                        default:
                    }
                }*/
                if(_framer % FrameRate.ANIMATE_FRAME_RATE == 0)
                {
                    var vo:HitResultVO;
                    switch (effect.type)
                    {
                        case AddEffectType.ROLE1_PASSIVE_FIRE:
                            vo = new HitResultVO();
                            vo.hurt = effect.value * effect.value;
                                if(vo.hurt > sourceRole.getHpMax() * 0.01) vo.hurt = sourceRole.getHpMax() * 0.01;
                            vo.hitType = HitType.REAL;
                            sourceRole.loseHp(vo);
                            break;
                        case AddEffectType.POISON:
                            vo = new HitResultVO();
                            vo.hurt = effect.value;
                            vo.hitType = HitType.MAGIC;
                            sourceRole.loseHp(vo);
                    }
                }
                //以下是对每一帧的处理
                switch (effect.type)
                {
                    case AddEffectType.STUN:
                        sourceRole.setStatic();
                        sourceRole.getBBDC().stop();
                        break;
                }
                //以下是对buff时间终止的处理
                if (!effect.isForever)
                {
                    if(effect.frame <= 0) removeEffect(effect);
                    else effect.frame--;
                }
            }
            //以下是处理角色发光
            renderGlowFilter();
            _framer++;
        }
        
        public function isCannotControlSkill():Boolean
        {
            for each(var effect:AddEffectVO in curEffectArray)
            {
                if (AddEffectType.isToughControl(effect.type))
                {
                    return true;
                }
            }
            return false;
        }
        
        /**
         * 给游戏实体添加效果
         * @param effArr 由Object组成的数组，内含Effect参数
         */
        public function addEffects(effArr:Array):void
        {
            if (!sourceRole || sourceRole.isDead())
            {
                return;
            }
            for each (var obj:Object in effArr)
            {
                var vo:AddEffectVO = new AddEffectVO();
                vo.updateFromObject(obj);
                addEffect(vo);
            }
        }
        
        /**
         * 添加effect的总路线
         * @param vo 要添加的effect
         */
        private function addEffect(vo:AddEffectVO):void
        {
            var curEffect:AddEffectVO = getEffectByType(vo.type);
            var isNewEffect:Boolean = true;
            if (curEffect)
            {
                switch (vo.type)
                {
                    case AddEffectType.ROLE1_PASSIVE_FIRE:
                        curEffect.frame = vo.frame;
                        curEffect.value += vo.value;
                        if(curEffect.value > 5) curEffect.value = 5;
                        isNewEffect = false;
                        break;
                    case AddEffectType.ROLE1_SKILL_HYJJ:
                        curEffect.frame = vo.frame;
                            curEffect.value = vo.value;
                        isNewEffect = false;
                        /*case SHIELD:
                            obj.frame += obj.frame;
                            curEffect.value += obj.value;
                            isNewEffect = false;
                            break;
                        case REFLECT_SHIELD:
                            obj.frame += obj.frame;
                            curEffect.value += obj.value;
                            isNewEffect = false;
                            break;
                        case BAJIE_DUNPAI_BUFF:
                            curEffect.startTime = _framer;
                            isNewEffect = false;
                            break;
                        default:*/
                }
            }
            //已经判定为新的效果，添加到效果数组内
            if (isNewEffect)
            {
                //破幻花链和花宴对硬控的实行办法
                /*if (isToughControl(obj))
                {
                    if (sourceRole is BaseHero && (sourceRole as BaseHero).getPlayer() != null)
                    {
                        var player:PlayerDataVO = (sourceRole as BaseHero).getPlayer();
                        if (player.getCurEquipByType("zbsp"))
                        {
                            if (player.getCurEquipByType("zbsp").equipId == "phhl" || player.getCurEquipByType("zbsp").equipId == "hy")
                            {
                                addeffect.frame = addeffect.frame > 5 ? 5 : addeffect.frame;
                                trace("硬控饰品被拦截一次");
                            }
                        }
                    }
                }*/
                curEffectArray.push(vo);
            }
        }
        public function getEffectByType(type:int):AddEffectVO
        {
            if (curEffectArray.length == 0)
            {
                return null;
            }
            for each (var eff:AddEffectVO in curEffectArray)
            {
                if (eff.type == type)
                {
                    return eff;
                }
            }
            return null;
        }
        
        /**
         * 获取目标buff的剩余时间
         * @param type 目标名称
         * @return 剩余时间：帧
         */
        public function getEffectLeftTime(type:int):int
        {
            var buff:AddEffectVO = getEffectByType(type);
            if (buff != null)
            {
                return buff.frame - (_framer - buff.startTime);
            }
            return 0;
        }
        
        
        public function hasEffect(type:int):Boolean
        {
            return getEffectByType(type) != null;
        }
        
        public function removeEffectByType(id:int):void
        {
            var vo:AddEffectVO;
            for (var i:int = curEffectArray.length - 1; i >= 0; i--)
            {
                vo = curEffectArray[i];
                if (vo.type == id)
                {
                    removeEffect(vo);
                }
            }
        }
        
        /**
         * 移除effect的总路线
         * @param vo 要移除的effect
         */
        private function removeEffect(vo:AddEffectVO):void
        {
            if(ArrayUtil.contains(curEffectArray,vo))
            {
                ArrayUtil.removeElement(curEffectArray,vo);
            }
            switch (vo.type)
            {
                case AddEffectType.ROLE1_PASSIVE_FIRE:
                    hideRole1PassiveFire();
                    break;
                case AddEffectType.ROLE1_SKILL_HYJJ:
                    hideRole1SkillHyjj();
                    break;
                case AddEffectType.POISON:
                    hidePoison();
                    break;
                case AddEffectType.STUN:
                    hideStun();
                    break;
            }
            /*switch (vo.type)
            {
                case POISON:
                    hidePoison();
                    break;
                case POISON_TIMES:
                    hidePoisonTimes();
                    break;
                case ICE:
                    hideIce();
                    break;
                case EYE_FIX:
                    hideEyeFix();
                    break;
                case STUN:
                    hideStun();
                    break;
                case BAJIE_DUNPAI_BUFF:
                    hideBajieDunpaiBuff();
                    break;
                case MAGIC_LEAF_CURE:
                    hide_magic_laf_cure();
                    break;
                case SHIELD:
                case REFLECT_SHIELD:
                    hide_magic_umb_def();
                    break;
                case SPEED_UP:
                    hideSpeedUp();
                    break;
                case FIRE:
                    hideFire();
                    break;
                case PET_SXKB:
                    hide_sxkb();
                    break;
                case PET_FSNL:
                    hide_fsnl();
                    break;
                case FORBID_ADD_HP:
                    hide_forbidAddHp();
                    break;
                case MONSTER36Bullet4:
                    hide_monster36bullet4();
                    break;
                case Monster37FIX:
                    hide_monster37fix();
                    break;
                case CURE_AFTER_KILL_MONSTER:
                    hide_shenmishangren();
                    break;
                case MONSTER42_GREEN:
                    hide_monster42_green();
                    break;
                case MONSTER42_BLUE:
                    hide_monster42_blue();
                    break;
                case MONSTER53_TIE:
                    hideMonster53Tie();
                    break;
                case PET_RABBIT4_BUFF:
                    hidePetRabbit4Buff();
                    break;
                case MONSTER65_TIED_PET:
                    hideMonster65tied();
                    break;
                case MONSTER65_AOE:
                    hideMonster65aoe();
                    break;
                case MONSTER114FEAR:
                    hideMonster114Fear();
                    break;
                case MONSTER115REDUCEHP:
                    hideMonster115Reducehp(parseInt(vo.hpSource));
                    break;
                case MONSTER117SLEEP:
                    hideMonster117sleep();
                    break;
                case TIANTINGZHANSHEN:
                    hideTiantingZhanshen();
                    break;
                case MONSTER129Buff:
                    hideMonster129Buff();
                    break;
                case MONSTER131MUSIC1:
                    hideMonster131Music1();
                    break;
                case MONSTER131MUSIC2:
                    hideMonster131Music2();
                    break;
                case MONSTER135Buff:
                    hideMonster135Buff();
                    break;
                case PET_RABBIT_MISS:
                    hidePetRabbitMissUp();
                    break;
                case PET_TURTLE_BUFF:
                    hidePetTurttleBuff();
                    break;
                case MAGIC_FLAG_DEBUFF:
                    hideMagicFlagDebuff();
                    break;
                case MAGIC_FLOWER_ADDBUFF:
                    hideMagicFlowerAddbuff();
                    break;
                case MAGIC_FLOWER_DEBUFF:
                    hideMagicFlowerDebuff();
                    break;
                case JIUHUANSHENGJING:
                    hide_jiuhuanshengjing();
                    break;
                case LXFB_BUFF:
                    hideXLFB();
                    break;
                case SXFB_BUFF:
                    hideSXFB();
                    break;
                case YXFB_BUFF:
                    hideYXFB();
                    break;
            }*/
        }
        
        /*public function reduceMagicUmbDef(param1:int):void
        {
            var buff1:Object = getEffectByType(SHIELD);
            var buff2:Object = getEffectByType(REFLECT_SHIELD);
            if (buff1 == null && buff2 == null)
            {
                sourceRole.reduceHp(param1);
                return;
            }
            var shieldVal:int = (buff1 != null ? buff1.defendValue : 0) + (buff2 != null ? buff2.defendValue : 0);
            if (shieldVal < param1)
            {
                if (buff1)
                {
                    removeEffect(buff1);
                }
                if (buff2)
                {
                    removeEffect(buff2);
                }
                sourceRole.reduceHp(Math.abs(param1 - shieldVal));
                return;
            }
            else if (buff1)
            {
                if (buff1.defendValue > param1)
                {
                    buff1.defendValue -= param1;
                    return;
                }
                else
                {
                    param1 -= buff1.defendValue;
                    buff1.defendValue = 0;
                    buff2.defendValue -= param1;
                }
            }
            if (buff1 && buff1.defendValue <= 0)
            {
                removeEffect(buff1);
            }
        }*/
        
        /**
         * 移除所有效果
         */
        public function removeAllEffect():void
        {
            for each (var eff:AddEffectVO in curEffectArray)
            {
                removeEffect(eff);
            }
        }
        
        protected function showRole1SkillHyjj():void
        {
            addEffectTexture("eff_Role1Hyjj",AddEffectType.ROLE1_SKILL_HYJJ,sourceRole.getLocalCollideCenter().x,sourceRole.getLocalCollideCenter().y);
        }
        
        protected function hideRole1SkillHyjj():void
        {
            removeEffectTexture(AddEffectType.ROLE1_SKILL_HYJJ);
        }
        
        protected function showRole1PassiveFire():void
        {
            //todo 修改素材名称
            addEffectTexture("FireEffect",AddEffectType.ROLE1_PASSIVE_FIRE,sourceRole.getLocalCollideCenter().x,sourceRole.getLocalCollideCenter().y);
        }
        
        protected function hideRole1PassiveFire():void
        {
            removeEffectTexture(AddEffectType.ROLE1_PASSIVE_FIRE);
        }
        
        protected function showPoison():void
        {
            addEffectTexture("PoisonEffect",AddEffectType.POISON,sourceRole.getLocalCollideCenter().x,sourceRole.getLocalCollideCenter().y);
        }
        
        protected function hidePoison():void
        {
            removeEffectTexture(AddEffectType.POISON);
        }
        
        protected function showStun():void
        {
            addEffectTexture("StunEffect",AddEffectType.STUN,sourceRole.getLocalCollideCenter().x,sourceRole.getLocalCollideCenter().y);
        }
        
        protected function hideStun():void
        {
            removeEffectTexture(AddEffectType.STUN);
        }
        
        /*protected function show_monster36bullet4():void
        {
            var _loc1_:FollowTargetBullet = new FollowTargetBullet("Monster36Linghun");
            _loc1_.x = sourceRole.x;
            _loc1_.y = sourceRole.y;
            _loc1_.rotation = int(Math.random() * 360);
            _loc1_.setOwner(sourceRole);
            _loc1_.setDisable();
            _loc1_.setDirect(0);
            _loc1_.setAction("hit1");
            gc.gameScene.addChild(_loc1_);
            sourceRole.magicBulletArray.push(_loc1_);
            if (sourceRole is BaseHero)
            {
                (sourceRole as BaseHero).getAttribute().reduceMp(100);
            }
        }
        
        protected function hide_monster36bullet4():void
        {
        }
        
        protected function show_forbidAddHp():void
        {
            addEffectTexture("Monster22_FORBID_ADD_HP", 1)
        }
        
        protected function hide_forbidAddHp():void
        {
            removeEffectTexture("eff_Monster22ForbidAddHp");
        }
        
        protected function show_fyjc():void
        {
            var bullet:FollowTargetBullet = new FollowTargetBullet("buff_fyjc");
            bullet.x = sourceRole.x;
            bullet.y = sourceRole.y;
            bullet.width = sourceRole.collideBox.width;
            bullet.height = sourceRole.collideBox.height;
            bullet.setOwner(sourceRole);
            bullet.setDisable();
            bullet.setDirect(sourceRole.getBBDC().getDirect());
            bullet.setAction("hit0");
            gc.gameScene.addChild(bullet);
            sourceRole.magicBulletArray.push(bullet);
        }
        
        protected function show_gjjc():void
        {
            var bullet:FollowTargetBullet = new FollowTargetBullet("buff_gjjc");
            bullet.x = sourceRole.x;
            bullet.y = sourceRole.y;
            bullet.width = sourceRole.collideBox.width;
            bullet.height = sourceRole.collideBox.height;
            bullet.setOwner(sourceRole);
            bullet.setDisable();
            bullet.setDirect(sourceRole.getBBDC().getDirect());
            bullet.setAction("hit0");
            gc.gameScene.addChild(bullet);
            sourceRole.magicBulletArray.push(bullet);
        }
        
        protected function showXLFB():void
        {
            if (lxCount >= gc.frameClips)
            {
                lxCount = 0;
                sourceRole.reduceHp(sourceRole.getHpMax() / 100);
            }
            lxCount++;
            sourceRole.setHue(-150);
        }
        
        protected function hideXLFB():void
        {
            sourceRole.setHue(0);
            lxCount = 0;
        }
        
        protected function showSXFB():void
        {
            if (sxCount >= gc.frameClips)
            {
                sxCount = 0;
                (sourceRole as BaseHero).reduceMp(sourceRole.getMpMax() / 100);
            }
            sxCount++;
            sourceRole.setHue(-50);
        }
        
        protected function hideSXFB():void
        {
            sourceRole.setHue(0);
            sxCount = 0;
        }
        
        protected function showYXFB():void
        {
            sourceRole.setHue(-100);
        }
        
        protected function hideYXFB():void
        {
            sourceRole.setHue(0);
        }
        
        protected function show_mfjc():void
        {
            var _loc1_:FollowTargetBullet = new FollowTargetBullet("buff_mfjc");
            _loc1_.x = sourceRole.x;
            _loc1_.y = sourceRole.y;
            _loc1_.width = sourceRole.collideBox.width;
            _loc1_.height = sourceRole.collideBox.height;
            _loc1_.setOwner(sourceRole);
            _loc1_.setDisable();
            _loc1_.setDirect(sourceRole.getBBDC().getDirect());
            _loc1_.setAction("hit0");
            gc.gameScene.addChild(_loc1_);
            sourceRole.magicBulletArray.push(_loc1_);
        }
        
        protected function show_smjc():void
        {
            var _loc1_:FollowTargetBullet = new FollowTargetBullet("buff_smjc");
            _loc1_.x = sourceRole.x;
            _loc1_.y = sourceRole.y;
            _loc1_.width = sourceRole.collideBox.width;
            _loc1_.height = sourceRole.collideBox.height;
            _loc1_.setOwner(sourceRole);
            _loc1_.setDisable();
            _loc1_.setDirect(sourceRole.getBBDC().getDirect());
            _loc1_.setAction("hit0");
            gc.gameScene.addChild(_loc1_);
            sourceRole.magicBulletArray.push(_loc1_);
        }
        
        protected function show_fsnl():void
        {
            var _loc1_:* = null;
            if (sourceRole.getChildByName("buff_fsnl"))
            {
                return;
            }
            try
            {
                _loc1_ = ResUtil.getNewObj("buff_fsnl");
                _loc1_.name = "buff_fsnl";
                _loc1_.width = sourceRole.collideBox.width;
                _loc1_.height = sourceRole.collideBox.height;
                sourceRole.addChild(_loc1_);
                
            } catch (e:Error)
            {
            
            }
        }
        
        protected function hide_fsnl():void
        {
            if (sourceRole.getChildByName("buff_fsnl"))
            {
                sourceRole.removeChild(sourceRole.getChildByName("buff_fsnl"));
            }
        }
        
        protected function show_sxkb():void
        {
            var _loc1_:* = null;
            if (sourceRole.getChildByName("buff_sxkb"))
            {
                return;
            }
            try
            {
                _loc1_ = ResUtil.getNewObj("buff_sxkb");
                _loc1_.name = "buff_sxkb";
                _loc1_.width = sourceRole.collideBox.width;
                _loc1_.height = sourceRole.collideBox.height;
                sourceRole.addChild(_loc1_);
            } catch (e:Error)
            {
            }
        }
        
        protected function hide_sxkb():void
        {
            if (sourceRole.getChildByName("buff_sxkb"))
            {
                sourceRole.removeChild(sourceRole.getChildByName("buff_sxkb"));
            }
        }
        
        protected function showMonster54Houjiao(param1:Point):void
        {//这个是西天王殿boss放出的那个龙头，不着急改先
            var targetPoint:Point = null;
            targetPoint = null;
            targetPoint = param1;
            if (sourceRole)
            {
                sourceRole.setStatic();
                if (sourceRole.getBBDC())
                {
                    sourceRole.getBBDC().stop();
                }
                if (sourceRole is BaseHero)
                {
                    BaseHero(sourceRole).setStatic();
                    if (BaseHero(sourceRole).getPlayer())
                    {
                        BaseHero(sourceRole).setLostKeyboard();
                    }
                }
                TweenMax.to(sourceRole, 1, {
                    "x": targetPoint.x,
                    "y": targetPoint.y,
                    "onComplete": function (param1:BaseObject):*
                    {
                        var bo:* = param1;
                        if (!bo.isDead())
                        {
                            TweenMax.to(bo, 2, {
                                "x": targetPoint.x,
                                "y": -20,
                                "onComplete": function (param1:BaseObject):*
                                {
                                    if (!param1.isDead())
                                    {
                                        if (param1 is BaseHero)
                                        {
                                            BaseHero(param1).setStatic();
                                        }
                                        if (param1.getBBDC())
                                        {
                                            param1.getBBDC().play();
                                        }
                                    }
                                },
                                "onCompleteParams": [bo]
                            });
                        }
                    },
                    "onCompleteParams": [sourceRole]
                });
            }
        }
        
        protected function showPetRabbit4Buff():void
        {
            addEffectTexture("petRabbit4AoyiBuff", 1, 0, -120);
        }
        
        protected function hidePetRabbit4Buff():void
        {
            removeEffectTexture(1);
        }
        
        protected function showPetRabbitMissUp():void
        {
            addEffectTexture("PetPetRabbitJFBuff", 1, 0, 20);
        }
        
        protected function hidePetRabbitMissUp():void
        {
            removeEffectTexture(1);
        }
        
        protected function showPetTurttleBuff():void
        {
            addEffectTexture("PetTurtle2Buff", 1, 0, -50);
        }
        
        protected function hidePetTurttleBuff():void
        {
            removeEffectTexture(1);
        }
        
        protected function showMonster131Music1():void
        {
            var _loc1_:MovieClip = null;
            if (!sourceRole.getChildByName("monster131MusicBuff1"))
            {
                try
                {
                    _loc1_ = ResUtil.getNewObj("monster131MusicBuff1");
                    _loc1_.x = 0;
                    _loc1_.y = -60;
                    _loc1_.name = "monster131MusicBuff1";
                    sourceRole.addChild(_loc1_);
                } catch (e:Error)
                {
                }
            }
        }
        
        protected function hideMonster131Music1():void
        {
            if (sourceRole.getChildByName("monster131MusicBuff1"))
            {
                sourceRole.removeChild(sourceRole.getChildByName("monster131MusicBuff1"));
            }
        }
        
        protected function showMonster135Buff():void
        {
            var _loc1_:MovieClip = null;
            if (!sourceRole.getChildByName("monster135Buff"))
            {
                try
                {
                    _loc1_ = ResUtil.getNewObj("BaseAddEffectSleep");
                    _loc1_.x = 0;
                    _loc1_.y = -30;
                    _loc1_.name = "monster135Buff";
                    sourceRole.addChild(_loc1_);
                } catch (e:Error)
                {
                }
            }
            if (sourceRole.getBBDC())
            {
                sourceRole.getBBDC().stop();
            }
            if (sourceRole is BaseHero)
            {
                if (BaseHero(sourceRole).getPlayer())
                {
                    BaseHero(sourceRole).setLostKeyboard();
                }
            }
        }
        
        protected function hideMonster135Buff():void
        {
            if (sourceRole.getChildByName("monster135Buff"))
            {
                sourceRole.removeChild(sourceRole.getChildByName("monster135Buff"));
            }
            if (!isCannotControlSkill())
            {
                if (sourceRole.getBBDC())
                {
                    sourceRole.getBBDC().play();
                }
            }
        }
        
        protected function showMonster131Music2():void
        {
            var _loc1_:MovieClip = null;
            if (!sourceRole.getChildByName("monster131MusicBuff2"))
            {
                try
                {
                    _loc1_ = ResUtil.getNewObj("monster131MusicBuff2");
                    _loc1_.x = 0;
                    _loc1_.y = -60;
                    _loc1_.name = "monster131MusicBuff2";
                    sourceRole.addChild(_loc1_);
                } catch (e:Error)
                {
                }
            }
        }
        
        protected function hideMonster131Music2():void
        {
            if (sourceRole.getChildByName("monster131MusicBuff2"))
            {
                sourceRole.removeChild(sourceRole.getChildByName("monster131MusicBuff2"));
            }
        }
        
        protected function showMonster129Buff():void
        {
            var _loc1_:MovieClip = null;
            if (!sourceRole.getChildByName("Monster129Bullet3PlayerBuff"))
            {
                try
                {
                    _loc1_ = ResUtil.getNewObj("Monster129Bullet3PlayerBuff");
                    _loc1_.x = 0;
                    _loc1_.y = 20;
                    _loc1_.name = "Monster129Bullet3PlayerBuff";
                    sourceRole.addChild(_loc1_);
                } catch (e:Error)
                {
                }
            }
        }
        
        protected function hideMonster129Buff():void
        {
            if (sourceRole.getChildByName("Monster129Bullet3PlayerBuff"))
            {
                sourceRole.removeChild(sourceRole.getChildByName("Monster129Bullet3PlayerBuff"));
            }
        }
        
        protected function showTiantingZhanshen():void
        {
            var _loc1_:MovieClip = null;
            if (!sourceRole.getChildByName("tiantingzhanshenBuff"))
            {
                try
                {
                    _loc1_ = ResUtil.getNewObj("tiantingzhanshenBuff");
                    _loc1_.x = 0;
                    _loc1_.y = -45;
                    _loc1_.name = "tiantingzhanshenBuff";
                    sourceRole.addChild(_loc1_);
                } catch (e:Error)
                {
                }
            }
        }
        
        protected function hideTiantingZhanshen():void
        {
            if (sourceRole.getChildByName("tiantingzhanshenBuff"))
            {
                sourceRole.removeChild(sourceRole.getChildByName("tiantingzhanshenBuff"));
            }
        }
        
        protected function showMonster117sleep():void
        {
            var _loc1_:MovieClip = null;
            if (!sourceRole.getChildByName("BaseAddEffectSleep"))
            {
                try
                {
                    _loc1_ = ResUtil.getNewObj("BaseAddEffectSleep");
                    _loc1_.x = 0;
                    _loc1_.y = -45;
                    _loc1_.name = "BaseAddEffectSleep";
                    sourceRole.addChild(_loc1_);
                } catch (e:Error)
                {
                }
            }
            if (sourceRole.getBBDC())
            {
                sourceRole.getBBDC().stop();
            }
            if (sourceRole is BaseHero)
            {
                if (BaseHero(sourceRole).getPlayer())
                {
                    BaseHero(sourceRole).setLostKeyboard();
                }
            }
        }
        
        protected function hideMonster117sleep():void
        {
            if (sourceRole.getChildByName("BaseAddEffectSleep"))
            {
                sourceRole.removeChild(sourceRole.getChildByName("BaseAddEffectSleep"));
            }
            if (!isCannotControlSkill())
            {
                if (sourceRole.getBBDC())
                {
                    sourceRole.getBBDC().play();
                }
            }
        }
        
        protected function showMonster114Fear():void
        {
            var _loc1_:MovieClip = null;
            if (!sourceRole.getChildByName("Monster114Bullet2Buff"))
            {
                try
                {
                    _loc1_ = ResUtil.getNewObj("Monster114Bullet2Buff");
                    _loc1_.x = 0;
                    _loc1_.y = -45;
                    _loc1_.name = "Monster114Bullet2Buff";
                    sourceRole.addChild(_loc1_);
                } catch (e:Error)
                {
                }
            }
        }
        
        protected function hideMonster114Fear():void
        {
            if (sourceRole.getChildByName("Monster114Bullet2Buff"))
            {
                sourceRole.removeChild(sourceRole.getChildByName("Monster114Bullet2Buff"));
            }
        }
        
        protected function showMonster66hurt():void
        {
            if (sourceRole is BaseHero)
            {
                BaseHero(sourceRole).reduceHp(sourceRole.getHpMax() * 0.03);
            }
            else if (sourceRole is BasePet)
            {
                BasePet(sourceRole).reduceHp(sourceRole.getHpMax() * 0.03);
            }
        }
        
        protected function showMonster65aoe():void
        {
            var _loc1_:MovieClip = null;
            if (!sourceRole.getChildByName("Monster65Bullet3Buff"))
            {
                try
                {
                    _loc1_ = ResUtil.getNewObj("Monster65Bullet3Buff");
                    _loc1_.x = 0;
                    _loc1_.y = 0;
                    _loc1_.name = "Monster65Bullet3Buff";
                    sourceRole.addChild(_loc1_);
                } catch (e:Error)
                {
                }
            }
        }
        
        protected function hideMonster65aoe():void
        {
            if (sourceRole.getChildByName("Monster65Bullet3Buff"))
            {
                sourceRole.removeChild(sourceRole.getChildByName("Monster65Bullet3Buff"));
            }
        }
        
        protected function showMonster65tied():void
        {
            var _loc1_:MovieClip = null;
            if (!sourceRole.getChildByName("Monster65Bullet2"))
            {
                try
                {
                    _loc1_ = ResUtil.getNewObj("Monster65Bullet2");
                    _loc1_.x = 0;
                    _loc1_.y = 0;
                    _loc1_.name = "Monster65Bullet2";
                    sourceRole.addChild(_loc1_);
                } catch (e:Error)
                {
                }
            }
            if (sourceRole is BasePet)
            {
                BasePet(sourceRole).getBBDC().stop();
            }
        }
        
        protected function hideMonster65tied():void
        {
            if (sourceRole.getChildByName("Monster65Bullet2"))
            {
                sourceRole.removeChild(sourceRole.getChildByName("Monster65Bullet2"));
            }
            if (sourceRole is BasePet)
            {
                BasePet(sourceRole).getBBDC().play();
            }
        }
        
        protected function show_monster37fix():void
        {
            var _loc1_:MovieClip = null;
            if (!sourceRole.getChildByName("Monster37Bullet2_2"))
            {
                try
                {
                    _loc1_ = ResUtil.getNewObj("Monster37Bullet2_2");
                    _loc1_.x = 0;
                    _loc1_.y = 0;
                    if (sourceRole.getBBDC().getDirect() == 1)
                    {
                        McUtil.flipHorizontal(_loc1_, -1);
                    }
                    _loc1_.name = "Monster37Bullet2_2";
                    sourceRole.addChild(_loc1_);
                } catch (e:Error)
                {
                }
            }
        }
        
        protected function hide_monster37fix():void
        {
            if (sourceRole.getChildByName("Monster37Bullet2_2"))
            {
                sourceRole.removeChild(sourceRole.getChildByName("Monster37Bullet2_2"));
            }
        }
        
        protected function showMonster53Tie():void
        {
            var _loc1_:* = null;
            if (!sourceRole.getChildByName("Monster53Bullet2"))
            {
                _loc1_ = ResUtil.getNewObj("Monster53Bullet2");
                _loc1_.name = "Monster53Bullet2";
                sourceRole.addChild(_loc1_);
            }
            sourceRole.setStatic();
            if (sourceRole.getBBDC())
            {
                sourceRole.getBBDC().stop();
            }
            if (sourceRole is BaseHero)
            {
                BaseHero(sourceRole).setStatic();
                if (BaseHero(sourceRole).getPlayer())
                {
                    BaseHero(sourceRole).setLostKeyboard();
                }
            }
        }
        
        protected function hideMonster53Tie():void
        {
            if (sourceRole.getChildByName("Monster53Bullet2"))
            {
                sourceRole.removeChild(sourceRole.getChildByName("Monster53Bullet2"));
            }
            if (sourceRole.getBBDC())
            {
                sourceRole.getBBDC().play();
            }
        }
        
        protected function show_magic_umb_def():void
        {
            addEffectTexture("MagicUmbrellaEffect", 1);
        }
        
        protected function hide_magic_umb_def():void
        {
            removeEffectTexture(1);
        }
        
        protected function show_magic_laf_cure():void
        {
            addEffectTexture("MagicLeafEffect", 1);
        }
        
        protected function hide_magic_laf_cure():void
        {
            removeEffectTexture(1);
        }
        
        protected function showMagicFlagDebuff():void
        {
            addEffectTexture("MagicFlagDebuff", 1);
        }
        
        protected function hideMagicFlagDebuff():void
        {
            removeEffectTexture(1);
        }
        
        protected function showMagicFlowerAddbuff():void
        {
            addEffectTexture("MagicFlowerAddbuff", 1);
        }
        
        protected function hideMagicFlowerAddbuff():void
        {
            removeEffectTexture(1);
        }
        
        protected function showMagicFlowerDebuff():void
        {
            addEffectTexture("MagicFlowerDebuff", 1);
        }
        
        protected function hideMagicFlowerDebuff():void
        {
            removeEffectTexture("eff_MagicFlowerDebuff");
        }
        
        protected function showMonster115Reducehp():void
        {
            //神兽饕餮buff，瞬间减掉玩家50%血量，在一段时间后加回来
            var _loc1_:int = 0;
            if (sourceRole is BaseHero)
            {
                _loc1_ = (sourceRole as BaseHero).getAttribute().hp / 2;
            }
            else if (sourceRole is BasePet)
            {
                _loc1_ = int((sourceRole as BasePet).getHp() / 2);
            }
            sourceRole.reduceHp(_loc1_);
            var _loc2_:Object = getEffectByType(MONSTER115REDUCEHP);
            if (_loc2_)
            {
                _loc2_.hpSource = _loc1_;
            }
        }
        
        protected function hideMonster115Reducehp(param1:int):void
        {
            if (sourceRole is BaseHero)
            {
                (sourceRole as BaseHero).cureHp(param1);
            }
            else if (sourceRole is BasePet)
            {
                (sourceRole as BasePet).cureHp(param1);
            }
        }
        
        protected function show_pet_tiger_sxhz(param1:uint, param2:uint):void
        {
            var point:Point;
            var direct:uint = param2;
            sourceRole.setStatic();
            if (sourceRole.getBBDC())
            {
                sourceRole.getBBDC().stop();
            }
            if (sourceRole is BaseHero)
            {
                BaseHero(sourceRole).setStatic();
                if (BaseHero(sourceRole).getPlayer())
                {
                    BaseHero(sourceRole).setLostKeyboard();
                }
            }
            sourceRole.setLostGravity();
            point = new Point();
            if (direct == 0)
            {
                point.x = sourceRole.x - 100;
            }
            else
            {
                point.x = sourceRole.x + 100;
            }
            point.y = sourceRole.y - 50;
            TweenMax.to(sourceRole, 0.5, {
                "x": point.x, "y": point.y, "onComplete": function (param1:BaseObject):*
                {
                    var bo:* = param1;
                    if (!bo.isDead())
                    {
                        TweenMax.delayedCall(2, function (param1:BaseObject):*
                        {
                            if (!param1.isDead())
                            {
                                if (param1 is BaseHero)
                                {
                                    BaseHero(param1).setStatic();
                                    if (BaseHero(param1).getPlayer())
                                    {
                                        BaseHero(param1).setLostKeyboard();
                                    }
                                }
                                param1.resetGravity();
                                if (param1.getBBDC())
                                {
                                    param1.getBBDC().play();
                                }
                            }
                            else
                            {
                                param1.setAction("dead");
                                param1.setInvincible(20);
                                param1.resetGravity();
                                if (param1.getBBDC())
                                {
                                    param1.getBBDC().play();
                                }
                            }
                        }, [bo]);
                    }
                    else
                    {
                        bo.setAction("dead");
                        bo.setInvincible(20);
                        bo.resetGraity();
                        if (bo.getBBDC())
                        {
                            bo.getBBDC().play();
                        }
                    }
                }, "onCompleteParams": [sourceRole]
            });
        }
        
        protected function show_monster42_green():void
        {
            addEffectTexture("Monster42BulletBuffGreen", "eff_Monster42BulletBuffGreen");
        }
        
        protected function hide_monster42_green():void
        {
            removeEffectTexture("eff_Monster42BulletBuffGreen");
        }
        
        protected function show_monster42_blue():void
        {
            addEffectTexture("Monster42BulletBuffBlue", "eff_Monster42BulletBuffBlue");
        }
        
        protected function hide_monster42_blue():void
        {
            removeEffectTexture("eff_Monster42BulletBuffBlue");
        }
        
        protected function show_shenmishangren():void
        {
            addEffectTexture("ShenMiBuff", "eff_ShenMiBuff");
        }
        
        protected function hide_shenmishangren():void
        {
            removeEffectTexture("eff_ShenMiBuff");
        }
        
        protected function showBajieDunpaiBuff():void
        {
            addEffectTexture("Role3Bullet5Buff", "eff_HolyShield", -20, -80);
        }
        
        protected function hideBajieDunpaiBuff():void
        {
            removeEffectTexture("eff_HolyShield");
        }
        
        protected function showEyeFix():void
        {
            addEffectTexture("eyefixBuff", "eff_EyeFix", 0, -20);
            if (sourceRole is BaseHero)
            {
                if (BaseHero(sourceRole).getPlayer())
                {
                    BaseHero(sourceRole).setLostKeyboard();
                }
            }
            sourceRole.setStatic();
        }
        
        protected function hideEyeFix():void
        {
            removeEffectTexture("eff_EyeFix");
        }
        
        protected function showSpeedUp():void
        {
            addEffectTexture("SpeedUp", "eff_SpeedUp", 0, 25);
        }
        
        protected function hideSpeedUp():void
        {
            removeEffectTexture("eff_SpeedUp");
        }
        
        protected function showFire():void
        {
            addEffectTexture("FireBuff", "eff_Fire");
        }
        
        protected function hideFire():void
        {
            removeEffectTexture("eff_Fire");
        }
        
        protected function showStun():void
        {
            if (sourceRole.getBBDC() && sourceRole.getBBDC().getDirect() == 0)
            {
                addEffectTexture("Stun", "eff_Stun", 35, -30);
            }
            else if (sourceRole.getBBDC() && sourceRole.getBBDC().getDirect() == 1)
            {
                addEffectTexture("Stun", "eff_Stun", -35, -30);
            }
            else
            {
                addEffectTexture("Stun", "eff_Stun", 0, -30);
            }
            if (!sourceRole)
            {
                return;
            }
            if (sourceRole is BaseHero)
            {
                if (BaseHero(sourceRole).getPlayer())
                {
                    BaseHero(sourceRole).setLostKeyboard();
                }
            }
            if (sourceRole.getBBDC())
            {
                sourceRole.getBBDC().stop();
            }
        }
        
        protected function hideStun():void
        {
            removeEffectTexture("eff_Stun");
            if (!sourceRole)
            {
                return;
            }
            if (sourceRole.getBBDC())
            {
                sourceRole.getBBDC().play();
            }
        }
        
        protected function showIce():void
        {
            var source:DisplayObject = addEffectTexture("PetHorseIceEffect", "eff_Ice");
            source.width = sourceRole.collideBox.width;
            source.height = sourceRole.collideBox.height;
            if (!sourceRole)
            {
                return;
            }
            if (sourceRole is BaseHero)
            {
                BaseHero(sourceRole).setStatic();
                if (BaseHero(sourceRole).getPlayer())
                {
                    BaseHero(sourceRole).setLostKeyboard();
                }
            }
            if (sourceRole.getBBDC())
            {
                sourceRole.getBBDC().stop();
            }
        }
        
        protected function hideIce():void
        {
            removeEffectTexture("eff_Ice");
            if (!sourceRole)
            {
                return;
            }
            if (sourceRole.getBBDC())
            {
                sourceRole.getBBDC().play();
            }
        }
        
        protected function showPoison():void
        {
            addEffectTexture("PoisonBuff", "eff_Poison");
        }
        
        protected function hidePoison():void
        {
            removeEffectTexture("eff_Poison");
        }
        
        protected function showPoisonTimes():void
        {
            addEffectTexture("PoisonBuff", "eff_PoisonTimer");
        }
        
        protected function hidePoisonTimes():void
        {
            removeEffectTexture("eff_PoisonTimer");
        }
        
        protected function show_jiuhuanshengjing():void
        {
            addEffectTexture("JIUHUANSHENGJING", "eff_JIUHUANSHENGJING", -35, -30);
        }
        
        protected function hide_jiuhuanshengjing():void
        {
            removeEffectTexture("eff_JIUHUANSHENGJING");
        }*/
        
        protected function renderGlowFilter():void
        {
            //无敌滤镜 > 霸体滤镜 > 无双滤镜
            if (!glow)
            {
                glow = new GlowFilter(0xFF0000, 1, 15, 15, 1.5, BitmapFilterQuality.HIGH, false, false);
            }
            var needGlow:Boolean = false;
            if (sourceRole.isGXP)
            {
                if (sourceRole is Role1)
                {
                    glow.color = 0xFF0000;
                }
                /*else if (sourceRole is Role2)
                {
                    glow.color = 0x0000FF;
                }
                else if (sourceRole is Role3)
                {
                    glow.color = 0xFFCC33;
                }
                else if (sourceRole is Role4)
                {
                    glow.color = 0x00FF00;
                }
                else if (sourceRole is BasePet)
                {
                    glow.color = 0x99FF00;
                }*/
                needGlow = true;
            }
            if (sourceRole.isSteelBody())
            {
                glow.color = 0xFFFFFF;
                needGlow = true;
            }
            if (sourceRole.isInvincible())
            {
                glow.color = 0x333333;
                needGlow = true;
            }
            if(!SettingManager.getSettingVO().isShowFilter) needGlow = false;
            if (!needGlow)
            {
                sourceRole.filters = [];
            }
            else
            {
                sourceRole.filters = [glow];
                if (glow.blurX > 6 && glow.alpha == 1)
                {
                    glow.blurX--;
                    glow.blurY--;
                    if (glow.blurX == 6)
                    {
                        glow.alpha = 0.8;
                    }
                }
                if (glow.blurX < 15 && glow.alpha == 0.8)
                {
                    glow.blurX++;
                    glow.blurY++;
                    if (glow.blurX == 15)
                    {
                        glow.alpha = 1;
                    }
                }
            }
        }
        
        /**
         * 添加效果贴图
         * @param texSourceName 资源的链接名称
         * @param effectId 添加后的mc名称，与去除的时候名称对应。最好采用eff_ + 大驼峰命名
         * @param texPosX 贴图x位置
         * @param texPosY 贴图y位置
         * @return 返回对象，可以对其进行后续的操作
         */
        private function addEffectTexture(texSourceName:String, effectId:int, texPosX:Number = 0, texPosY:Number = 0):AnimationClip
        {
            var effName:String = "eff_" + effectId.toString();
            var disp:AnimationClip = sourceRole.effectContainer.getChildByName(effName) as AnimationClip;
            if (!disp)
            {
                try
                {
                    var ani:AnimationClip = AnimationManager.getAnimationClip(texSourceName);
                    ani.name = effName;
                    ani.x = texPosX;
                    ani.y = texPosY;
                    sourceRole.effectContainer.addChild(ani);
                    return ani;
                } catch (e:Error)
                {
                    Logger.log(e.message);
                    return null;
                }
            }
            return disp;
        }
        
        /**
         * 移除效果贴图
         * @param effectId 贴图(准确来说是mc)名称
         *                          要与添加的时候名称一致，否则无法正确移除
         */
        private function removeEffectTexture(effectId:int):void
        {
            var ani:AnimationClip = sourceRole.effectContainer.getChildByName("eff_" + effectId.toString()) as AnimationClip;
            if (ani)
            {
                ani.removeFromParent()
            }
        }
        
        /**
         * 判断是否是硬控，在解控中能用到
         * @param param1 effectObject
         * @return 判断值
         */
        private function isToughControl(param1:Object):Boolean
        {
            const arr:Array = [ICE, PET_TIGER_SXHZ, EYE_FIX, MONSTER53_TIE/*, STUN*/, MONSTER117SLEEP, MONSTER135Buff];
            return arr.indexOf(param1.type) != -1;
        }
        
        public function destroy():void
        {
            curEffectArray = [];
            _framer = 0;
            sourceRole = null;
        }
    }
}
